{% extends 'oracle/base.html' %}
{% load oracle %}

{% block css %}
    <style>
        .form-control.error {
            background: rgb(251, 227, 228);
            border: 1px solid #fbc2c4;
            color: #8a1f11;
        }
    </style>
{% endblock %}

{% block content %}
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-lg-12">
                <div class="ibox ">
                    <div class="ibox-title">
                        <h5>{{ data.form_name }}</h5>
                        <div class="ibox-tools">
                            {% if "return_url" in data %}
                                <a class="btn btn-success" type="button" style="color: white!important;"
                                   href="{{ data.return_url }}">
                                    <i class="fa fa-reply"></i> 回到列表
                                </a>
                            {% endif %}
                        </div>
                    </div>
                    <div class="ibox-content">
                        <form class="form-horizontal" method="post" novalidate>
                            {% csrf_token %}
                            <p>{% if "form_description" in data %}{{ data.form_description }}{% endif %}</p>
                            {% for field in data.form %}
                                <div class="form-group col-lg-10 {% if field.name == "key" or field.name == "status" or field.name == "level" %} d-none{% endif %}">
                                    <label class="col-form-label">{{ field.label }}</label>
                                    <label id="{{ field.label }}-error" class="error">{% if field.errors %}{{ field.errors.0 }}{% endif %}</label>
                                    {{ field }}
                                </div>
                            {% endfor %}
                            <div class="form-group row">
                                <div class="col-lg-offset-2 col-lg-10 mt-3">
                                    <button class="btn btn-outline btn-primary dim" type="submit">
                                        <i class="fa fa-check"></i> 保存数据
                                    </button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
{% endblock %}